<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>Purple_loginform Website Template </title>
    <link href="../static/login/css/style.css" rel="stylesheet" type="text/css" media="all"/>
    <script type="text/javascript" src="../static/login/js/jquery.min.js"></script>
</head>
<body>
<div class=metanav>
    {% if not session.logged_in %}
        <a href="{{ url_for('login') }}">log in</a>
    {% else %}
        <a href="{{ url_for('logout') }}">log out</a>
    {% endif %}
</div>
<div class="message warning">
    <div class="inset">
        <div class="login-head">
            <h1>用户登录</h1>
            <div class="alert-close"></div>
        </div>
        <form action="{{ url_for('login') }}" method="POST" onsubmit="return checkForm()">
            <ul>
                <li><input type="text" class="text" value="用户名" name="username" id="username" onFocus="this.value = '';"
                           onBlur="if (this.value == '') {this.value = '用户名';}"/><a href="#" class=" icon user"></a>
                </li>
                <li><input type="password" name="password" id="password" value=""/> <a href="#" class="icon lock"></a>
                </li>
            </ul>

            <div class="submit">
                <input type="submit" value="登录">
                <h4><a href="#">忘记密码?</a></h4>
                <div class="clear"></div>
            </div>
        </form>
    </div>
</div>

<!--- footer --->
<div class="footer">
    <p>Copyright &copy; 2014.</p>
</div>
<script src="../static/layui-v1.0.9_rls/layui.js"></script>
<script type='text/javascript'>
    layui.use(['layer'], function () {
        var layer = layui.layer;
    });

    function checkForm() {
        var name = document.getElementById("username").value;
        var pwd = document.getElementById("password").value;
        console.log(name);
        console.log(pwd);
        if (name == "" || name == null) {
            layer.msg("用户名不能为空");
            return false;
        }
        if (pwd == "" || pwd == null) {
            layer.msg("密码不能为空");
            return false;
        }
        return true;
    }
</script>

</body>
</html>